package com.alinesno.cloud.common.web.basic.auth.repository;

import java.util.List;
import java.util.Optional;

import com.alinesno.cloud.common.facade.orm.repository.IBaseJpaRepository;
import com.alinesno.cloud.common.web.basic.auth.entity.BasicResourceEntity;

/**
 * <p>
  *  持久层接口
 * </p>
 *
 * @author WeiXiaoJin
 * @since 2018-12-16 17:53:19
 */
public interface BasicResourceRepository extends IBaseJpaRepository<BasicResourceEntity, String> {

	/**
	 * 菜单查询 
	 * @param resourceParent
	 * @return
	 */
	List<BasicResourceEntity> findAllByResourceParent(String resourceParent);

	/**
	 * 菜单查询 
	 * @param resourceParent
	 * @return
	 */
	Optional<BasicResourceEntity> findByResourceParentAndApplicationId(String responseParent , String applicationId);
	
	/**
	 * 通过id删除
	 * @param id
	 */
	void deleteByApplicationId(String applicationId);

	/**
	 * 通过状态查询菜单 
	 * @param i
	 * @return
	 */
	List<BasicResourceEntity> findAllByHasStatus(int hasStatus);

	/**
	 * 排序查询
	 * @param hasStatus
	 * @return
	 */
	List<BasicResourceEntity> findAllByHasStatusOrderByResourceOrderAsc(int hasStatus);

}
